#!/usr/bin/perl
# bidirender.pl
use warnings;
use strict;

use FriBidi;

my ($uniStr, $visStr, $outStr);

open (BIDISAMPLE,"bidisample");
while(<BIDISAMPLE>){
   chop;   # remove line separator
   $uniStr = caprtl_to_unicode ( $_ );   # convert line to FriBidi string
   $visStr = log2vis ( $uniStr );   # run it through the bidi algorithm
   $outStr = unicode_to_caprtl ( $visStr );   # convert it back to format
                                              # that can be displayed on
                                              # usual ASCII terminal
print $outStr,"\n";
}
